package com.huowenjie.controller;


import com.huowenjie.entity.TestUser;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("test")
@Api(tags = "一个测试的接口类",description = "这个接口是我自己来测试的 ^_^ !")
public class TestController {

    @RequestMapping(value = "test01",method = RequestMethod.POST)
    @ApiOperation(value = "方法的描述信息（比如：这个 方法的作用《这是个查询用户的方法》）", tags = "测试")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userName",dataTypeClass = String.class,defaultValue = "默认的用户名",value = "这个参数是用户名8888"),
            @ApiImplicitParam(name = "password",dataTypeClass = String.class,defaultValue = "默认的密码")
    })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "资源不存在")
    })
    public String test01(
            @ApiParam(name = "userName",value = "这个参数是用户名",required = true) @RequestBody String userName
            ,@RequestParam String password){

        return userName;
    }




    @RequestMapping("test02")
    @ApiOperation(tags = "test02",value = "这是第二个测试方法",notes = "这是第二个测试方法notes")
    @ApiResponses({
            @ApiResponse(code = 200,message = "请求成功")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "testUser",value = "这是一个用户的实体类用来就收参数",required = true,dataTypeClass =TestUser.class)
    })
    public TestUser test02(@RequestBody TestUser testUser){
        testUser.setAddress("这是地址信息");
        return testUser;
    }
}